using UnityEngine;
using UnityEngine.Networking;

// 资源包代理
// TODO 修改为下载资源与本地加载
public class SceneBundleAgent : AgentContext<SceneBundleAgent,UFrame.AssetBundles.AssetBundleController>
{
    protected bool m_inited;

    protected override void OnCreate()
    {
        base.OnCreate();
#if UNITY_EDITOR
        //Instance.Simulation = GameManager.Instance.SimulationBundle;
#endif
    }

    public static void StatInitialize()
    {
        if (!Context.m_inited)
        {
            Context.m_inited = true;
            Instance.StartUpLocaly(Application.persistentDataPath + "/AssetBundle/Scene", "Scene", Context.OnInitCallBack);
        }
    }

    private void OnInitCallBack(bool ok)
    {
        if (!ok)
        {
            Debug.LogError("SceneBundleAgent init failed!");
        }
        else
        {
            Debug.Log("SceneBundleAgent init ok");
            AgentSelf.SetInited();
        }
    }
}